﻿using UnityEngine;
using System.Collections;


public class autoMov : MonoBehaviour 
{

	//此脚本来处理按钮上下缓动效果
	private float radian = 0;
	private float perRadian = 0.02f;
	private Vector3 oldPosition;
	//浮动半径
	public float radius = 0.2f;

	void Start() 
	{
		//得到按钮初始位置
		oldPosition = transform.position;
		Debug.Log(oldPosition);
	}

	void Update() 
	{
		radian += perRadian;
		float dy = Mathf.Cos(radian)*radius;
		//更新坐标
		transform.position = oldPosition + new Vector3(0, dy, 0);
		Debug.Log (transform.position);
	}

}
